package com.gitee.thread.problem;

import com.gitee.thread.problem.task.JvmOOM;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author ming.yan-1
 * @version V1.0
 * @Title com.gitee.thread.problem
 * @Description
 * @date 2018/10/9  下午6:14
 */
public class Problem {

    /**
     * 堆内存溢出
     */
    public static void JvmOOM(){
        ExecutorService executorService = Executors.newFixedThreadPool(300);
        for(int i = 0;i<10000;i++){
            JvmOOM jvmOOM = new JvmOOM(i);
            executorService.execute(jvmOOM);
        }
        System.out.println("任务创建并加入线程池完毕");
    }

    public static void main(String[] args) {
        JvmOOM();
    }
}
